package com.netcracker.training.automonic.parser;

import com.netcracker.training.automonic.parser.csv.CSVParser;

/**
 * Concept.
 * 
 * @author Vadim Gidulyan
 *
 */
@Deprecated
public class UsingParserExample
{

	private static String SITE = "www.finviz.com";
	
	public static void main(String[] args)
	{
		Parser p = new CSVParser();
		
		// In this method parser might prepare all resources that it needs to 
		// work, such as DAO, data for parsing, parsing templates etc.
		p.init(SITE);
		
		while (p.nextObject())
		{
			if (!p.isObjectExists()) // Checks in DB using DAO
				p.createObject(); // DAO saves object to DB
			
			// attributes from templates that parser retrieves
			if (!p.checkAttributes()) // Checks if object has all attributes
				p.fillAttributes();
			
			// statistics from templates that parser retrieves
			p.obtainStatistics(); // Obtain statistics for current object and 
			                      // saves it to DB
		}
	}

}
